// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Serialization;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.IndexManagement;

public sealed partial class IndexAndDataStreamAction
{
	/// <summary>
	/// <para>Data stream targeted by the action.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("data_stream")]
	public Elastic.Clients.Elasticsearch.DataStreamName DataStream { get; set; }

	/// <summary>
	/// <para>Index for the action.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("index")]
	public Elastic.Clients.Elasticsearch.IndexName Index { get; set; }
}

public sealed partial class IndexAndDataStreamActionDescriptor : SerializableDescriptor<IndexAndDataStreamActionDescriptor>
{
	internal IndexAndDataStreamActionDescriptor(Action<IndexAndDataStreamActionDescriptor> configure) => configure.Invoke(this);

	public IndexAndDataStreamActionDescriptor() : base()
	{
	}

	private Elastic.Clients.Elasticsearch.DataStreamName DataStreamValue { get; set; }
	private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; }

	/// <summary>
	/// <para>Data stream targeted by the action.</para>
	/// </summary>
	public IndexAndDataStreamActionDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamName dataStream)
	{
		DataStreamValue = dataStream;
		return Self;
	}

	/// <summary>
	/// <para>Index for the action.</para>
	/// </summary>
	public IndexAndDataStreamActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index)
	{
		IndexValue = index;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		writer.WritePropertyName("data_stream");
		JsonSerializer.Serialize(writer, DataStreamValue, options);
		writer.WritePropertyName("index");
		JsonSerializer.Serialize(writer, IndexValue, options);
		writer.WriteEndObject();
	}
}